<template>
  <div class="app-container calendar-list-container">
    <div class="filter-container" style="padding-bottom: 10px;display: flex"><!-- 上边的搜索条件 -->

      <el-select
        @change="handleFilter"
        v-model="reqData.query.startup_step"
        placeholder="核算单状态(可多选)">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
      <el-button class="filter-item" type="primary" icon="search" @click="handleFilter">搜索</el-button>
    </div>
    <!-- 展示数据的table -->
    <el-table
      :data="list"
      v-loading.body="listLoading"
      element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">

      <el-table-column max-width="250px" align="center" label="订单id">
        <template scope="scope">
          <span>{{scope.row.project_id}}</span>
        </template>
      </el-table-column>

      <el-table-column max-width="250px" align="center" label="行id">
        <template scope="scope">
          <span>{{scope.row.order_line_id}}</span>
        </template>
      </el-table-column>

      <el-table-column max-width="250px" align="center" label="订单号">
        <template scope="scope">
          <span>{{scope.row.project_no}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="数量" max-width="250px">
        <template scope="scope">
          <span>{{scope.row.count}}</span>
        </template>
      </el-table-column>

      <el-table-column max-width="250px" align="center" label="客户模号">
        <template scope="scope">
          <span>{{scope.row.cst_mold_no}}</span>
        </template>
      </el-table-column>

      <el-table-column max-width="250px" align="center" label="客户名称">
        <template scope="scope">
          <span>{{scope.row.cst_name}}</span>
        </template>
      </el-table-column>

      <el-table-column max-width="250px" align="center" label="订单产品状态">
        <template scope="scope">
          <span>{{startupStepText(scope.row.startup_step)}}</span>
        </template>
      </el-table-column>

      <el-table-column max-width="250px" align="center" label="类型名称">
        <template scope="scope">
          <span>{{scope.row.type_name}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="操作" max-width="250px">
        <template scope="scope">
          <el-button
            v-if="scope.row.startup_step == 'step100'"
            type="primary"
            @click.native='showStartBox(scope.row.order_line_id)'
            size="small" icon="edit">下达</el-button>
          <el-button
            v-if="scope.row.startup_step == 'step200'"
            size="small"
            type="success"
            @click.native='showSS(2,scope.row.order_line_id)'>完结</el-button>
          <el-button
            v-if="scope.row.startup_step == 'step200'"
            size="small"
            type="warning"
            @click.native="showSS(1,scope.row.order_line_id)">暂停</el-button>
          <el-button
            v-if="scope.row.startup_step == 'step300'"
            size="small"
            type="primary"
            @click.native="orderRestartup(scope.row.order_line_id)">开始</el-button>
          <el-button
            v-if="scope.row.startup_step == 'step00'"
            size="small"
            type="primary"
            @click.native="orderNotEnd(scope.row.order_line_id)">反完结</el-button>
        </template>
      </el-table-column>

    </el-table>

    <div v-show="!listLoading" class="pagination-container" style="margin-top: 30px;">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="reqData.curr_page"
                     :page-sizes="[1, 2, 3, 5]" :page-size="reqData.page_size" layout="total, sizes, prev, pager, next, jumper" :total="total_count">
      </el-pagination>
    </div>

    <el-dialog title="下达" :visible.sync="isShowStart" size="large" top="5%">

      <el-form class="small-space" :model="req_startup" label-position="right" label-width="90px" :inline="true">

        <el-form-item label="供货类型" label-width="100px">
          <el-select
            v-model="req_startup.order_startup.sup_type"
            clearable
            placeholder="供货类型"
            @change="supTypeChange">
            <el-option
              v-for="item in options_sup_type"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="数量" label-width="100px">
          <el-input v-model="req_startup.order_startup.count"
                    :disabled="true"></el-input>
        </el-form-item>

        <el-form-item label="未税单价" label-width="100px">
          <el-input v-model="req_startup.order_startup.up_not_tax"
                    :disabled="true"></el-input>
        </el-form-item>

        <el-form-item label="是否制定BOM" label-width="100px">
          <el-switch
            :disabled="is_crt_bom_readonly"
            v-model="req_startup.order_startup.is_crt_bom"
            on-color="#13ce66"
            off-color="#ff4949">
          </el-switch>
        </el-form-item>

        <el-form-item label="是否批量生产" label-width="100px">
          <el-switch
            v-model="req_startup.order_startup.is_batch_process"
            on-color="#13ce66"
            off-color="#ff4949"
            @change="isBpChange">
          </el-switch>
        </el-form-item>

        <form-box headText="目标成本">
          <el-button size="small" style="float: right" slot="btn">参考</el-button>

          <el-form-item label="设计费率" label-width="100px">
            <el-input
              @change="computeCost('design')"
              v-model="req_startup.order_startup.design_ratio"
              type="textarea"
              class="article-textarea"
              :rows="1" autosize placeholder="成本/单价%"></el-input>
          </el-form-item>
          <el-form-item label="设计费" label-width="100px">
            <el-input
              @change="computeRatio('design')"
              v-model="req_startup.order_startup.design_cost"
              type="textarea"
              class="article-textarea"
              :rows="1" autosize></el-input>
          </el-form-item>

          <el-form-item label="材料费率" label-width="100px">
            <el-input
              @change="computeCost('stuff')"
              v-model="req_startup.order_startup.stuff_ratio"
              type="textarea"
              class="article-textarea"
              :rows="1" autosize placeholder="成本/单价%"></el-input>
          </el-form-item>
          <el-form-item label="材料费" label-width="100px">
            <el-input
              @change="computeRatio('stuff')"
              v-model="req_startup.order_startup.stuff_cost"
              type="textarea"
              class="article-textarea"
              :rows="1" autosize></el-input>
          </el-form-item>

          <el-form-item label="加工费率" label-width="100px">
            <el-input
              @change="computeCost('process')"
              v-model="req_startup.order_startup.process_ratio"
              type="textarea"
              class="article-textarea"
              :rows="1" autosize placeholder="成本/单价%"></el-input>
          </el-form-item>
          <el-form-item label="加工费" label-width="100px">
            <el-input
              @change="computeRatio('process')"
              v-model="req_startup.order_startup.process_cost"
              type="textarea"
              class="article-textarea"
              :rows="1" autosize></el-input>
          </el-form-item>
        </form-box>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="isShowStart = false">取 消</el-button>
        <el-button type="primary" @click.native="orderStartup">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="暂停或完结原因" :visible.sync="isShowSS" size="small" top="10%">
      <el-input
        type="textarea"
        :rows="4"
        placeholder="请输入内容"
        v-model="req_OSS.reason">
      </el-input>
      <div slot="footer" class="dialog-footer">
        <el-button type="danger" @click="isShowSS = false">取消</el-button>
        <el-button type="success" @click.native="orderStartupStop()">确定</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
  import {
    orderStartupList,
    cstOrderLineInfo,
    orderStartup,
    orderNotEnd,
    orderRestartup,
    orderStartupStop
  } from '@/api/cstOrder/customerOrder'
  import formBox from '../../../components/formBox'
  import ElButton from "../../../../node_modules/element-ui/packages/button/src/button.vue";

  export default {
    name: 'quoteList',
    components:{
      ElButton,
      formBox
    },
    data() {
      return {
        isShowStart:false,
        isShowSS:false,
        is_crt_bom_readonly:false,
        list: [],
        listLoading: true,
        total_count:null,//数据总条数
        total_page:null,//总页数
        reqData: {
          client_type:1,
          company_id:null,
          curr_page:1,
          page_size:2,
          query:{
            startup_step:'step100'
          }
        },
        req_startup:{
          client_type:1,
          order_startup:{
            count:null,
            cst_mold_no:null,
            design_cost:null,
            design_ratio:null,
            is_batch_process:false,
            is_crt_bom:false,
            order_line_id:null,
            process_cost:null,
            process_ratio:null,
            stuff_cost:null,
            stuff_ratio:null,
            sup_type:null,
            up_not_tax:null
          }
        },
        options: [
          {
            value: 'step100',
            label: '待下达'
          },
          {
            value: 'step200',
            label: '在制'
          },
          {
            value: 'step300',
            label: '暂停'
          },
          {
            value: 'step00',
            label: '完结'
          }
        ],
        options_sup_type: [
          {
            value: '1',
            label: '自制'
          },
          {
            value: '2',
            label: '外购'
          }
        ],
        up:0,
        req_OSS:{
          client_type:1,
          flag:null,//1暂停，2完结
          order_line_id:null,
          reason:''//暂停/完结原因
        }
      }
    },
    mounted() {
      this.getList()
    },
    methods: {
      startupStepText(step){
        switch (step){
          case 'step100':
            return '待下达'
            break;
          case 'step200':
            return '在制'
            break;
          case 'step300':
            return '暂停'
            break;
          case 'step00':
            return '完结'
            break;
          default:
            return '未知'
            break;
        }
      },
      getList() {
        this.listLoading = true
        orderStartupList(this.reqData).then(res => {
          this.list = res.cst_order_list
          this.total_count = res.total_count
          this.total_page = res.total_page
          this.listLoading = false
        })
      },
      handleFilter() {
        this.reqData.curr_page = 1
        this.getList()
      },
      handleSizeChange(val) {
        this.reqData.page_size = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.reqData.curr_page = val
        this.getList()
      },
      showStartBox(lineId){
        this.req_startup.order_startup.order_line_id = lineId
        let req_lineInfo = {
          client_type:1,
          order_line_id:lineId
        }
        cstOrderLineInfo(req_lineInfo)  //获取行信息明细
          .then(res => {
            this.up = res.up
            this.req_startup.order_startup.up_not_tax = res.up
            this.req_startup.order_startup.count = res.count

            //给 费用费率做个初始赋值
            this.req_startup.order_startup.design_ratio = 33
            this.req_startup.order_startup.process_ratio = 33
            this.req_startup.order_startup.stuff_ratio = 34

            this.req_startup.order_startup.design_cost = (33 / 100 * parseFloat(res.up)).toFixed(2)
            this.req_startup.order_startup.process_cost = (33 / 100 * parseFloat(res.up)).toFixed(2)
            this.req_startup.order_startup.stuff_cost = (34 / 100 * parseFloat(res.up)).toFixed(2)

          })
          .catch(err => {
            console.log(err)
            this.$message.error('获取数量和单价失败')
          })
        this.isShowStart = true
      },
      supTypeChange(){  //供货类型change事件
        if(this.req_startup.order_startup.sup_type == '2'){
          this.req_startup.order_startup.is_crt_bom = false
          this.is_crt_bom_readonly = true
        }else{
          this.is_crt_bom_readonly = false
        }
      },
      isBpChange(){ //是否批量生产change事件
        if(this.req_startup.order_startup.is_batch_process){
          this.req_startup.order_startup.up_not_tax = parseFloat(this.up) * parseFloat(this.req_startup.order_startup.count)

          //如果是否批量生产 为 是 则 未税单价发生变化, 所以目标成本 里面的各个费用值也要相应的更新
          let up_not_tax = parseFloat(this.req_startup.order_startup.up_not_tax)  //未税单价
          let design_ratio = parseFloat(this.req_startup.order_startup.design_ratio)  //设计费率
          let process_ratio = parseFloat(this.req_startup.order_startup.process_ratio)  //加工费率
          let stuff_ratio = parseFloat(this.req_startup.order_startup.stuff_ratio)  //材料费率

          this.req_startup.order_startup.design_cost = (up_not_tax * design_ratio / 100).toFixed(2)
          this.req_startup.order_startup.process_cost = (up_not_tax * process_ratio /100).toFixed(2)
          this.req_startup.order_startup.stuff_cost = (up_not_tax * stuff_ratio / 100).toFixed(2)

        }else{
          this.req_startup.order_startup.up_not_tax = this.up

          //如果是否批量生产 为 是 则 未税单价发生变化, 所以目标成本 里面的各个费用值也要相应的更新
          let up_not_tax = parseFloat(this.req_startup.order_startup.up_not_tax)  //未税单价
          let design_ratio = parseFloat(this.req_startup.order_startup.design_ratio)  //设计费率
          let process_ratio = parseFloat(this.req_startup.order_startup.process_ratio)  //加工费率
          let stuff_ratio = parseFloat(this.req_startup.order_startup.stuff_ratio)  //材料费率

          this.req_startup.order_startup.design_cost = (up_not_tax * design_ratio / 100).toFixed(2)
          this.req_startup.order_startup.process_cost = (up_not_tax * process_ratio /100).toFixed(2)
          this.req_startup.order_startup.stuff_cost = (up_not_tax * stuff_ratio / 100).toFixed(2)
        }
      },
      computeRatio(type){ //计算费率
        let up_not_tax = parseFloat(this.req_startup.order_startup.up_not_tax)  //未税单价
        switch (type){
          case 'design':
            let design_cost = parseFloat(this.req_startup.order_startup.design_cost)  //设计费
            if(design_cost < (up_not_tax * 0.99)){

              //下面三行更新费率
              this.req_startup.order_startup.design_ratio = (design_cost / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.process_ratio = ((up_not_tax - design_cost) / 2 / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.stuff_ratio = ((up_not_tax - design_cost) / 2 / up_not_tax * 100).toFixed(2)

              //这下面的代码是更新其它的费用
              let design_ratio = parseFloat(this.req_startup.order_startup.design_ratio)  //设计费率
              this.req_startup.order_startup.process_cost = ((100 - design_ratio) / 2 / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.stuff_cost = ((100 - design_ratio) /2 / 100 * up_not_tax).toFixed(2)

            }else{  //如果填写的费用值超过或等于 未税单价,则当前费用变成百分之98. 其余两种各百分之一

              //下面三行更新费率
              this.req_startup.order_startup.design_ratio = 98.00
              this.req_startup.order_startup.process_ratio = 1.00
              this.req_startup.order_startup.stuff_ratio = 1.00

              //这下面的代码是更新其它的费用
              this.req_startup.order_startup.design_cost = (up_not_tax * 0.98).toFixed(2)
              this.req_startup.order_startup.process_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.stuff_cost = (up_not_tax * 0.01).toFixed(2)
            }


            break;
          case 'process':
            let process_cost = parseFloat(this.req_startup.order_startup.process_cost)  //加工费
            if(process_cost < (up_not_tax * 0.99)){

              //更新费率
              this.req_startup.order_startup.process_ratio = (process_cost / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.design_ratio = ((up_not_tax - process_cost) / 2 / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.stuff_ratio = ((up_not_tax - process_cost) / 2 / up_not_tax * 100).toFixed(2)

              //更新费用
              let process_ratio = parseFloat(this.req_startup.order_startup.process_ratio)  //加工费率
              this.req_startup.order_startup.design_cost = ((100 - process_ratio) / 2 / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.stuff_cost = ((100 - process_ratio) /2 / 100 * up_not_tax).toFixed(2)

            }else{  //如果填写的费用值超过或等于 未税单价,则当前费用变成百分之98. 其余两种各百分之一

              //下面三行更新费率
              this.req_startup.order_startup.design_ratio = 1.00
              this.req_startup.order_startup.process_ratio = 98.00
              this.req_startup.order_startup.stuff_ratio = 1.00

              //这下面的代码是更新其它的费用
              this.req_startup.order_startup.design_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.process_cost = (up_not_tax * 0.98).toFixed(2)
              this.req_startup.order_startup.stuff_cost = (up_not_tax * 0.01).toFixed(2)
            }

            break;
          case 'stuff':
            let stuff_cost = parseFloat(this.req_startup.order_startup.stuff_cost)  //材料费
            if(stuff_cost < (up_not_tax * 0.99)){

              //更新费率
              this.req_startup.order_startup.stuff_ratio = (stuff_cost / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.process_ratio = ((up_not_tax - stuff_cost) / 2 / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.design_ratio = ((up_not_tax - stuff_cost) / 2 / up_not_tax * 100).toFixed(2)

              //更新费用
              let stuff_ratio = parseFloat(this.req_startup.order_startup.stuff_ratio)  //材料费率
              this.req_startup.order_startup.process_cost = ((100 - stuff_ratio) / 2 / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.design_cost = ((100 - stuff_ratio) /2 / 100 * up_not_tax).toFixed(2)

            }else{  //如果填写的费用值超过或等于 未税单价,则当前费用变成百分之98. 其余两种各百分之一

              //下面三行更新费率
              this.req_startup.order_startup.design_ratio = 1.00
              this.req_startup.order_startup.process_ratio = 1.00
              this.req_startup.order_startup.stuff_ratio = 98.00

              //这下面的代码是更新其它的费用
              this.req_startup.order_startup.design_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.process_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.stuff_cost = (up_not_tax * 0.98).toFixed(2)
            }

            break;
          default:
            break;
        }
      },
      computeCost(type){  //计算费用
        let up_not_tax = parseFloat(this.req_startup.order_startup.up_not_tax)  //未税单价
        switch (type) {
          case 'design':
            let design_ratio = parseFloat(this.req_startup.order_startup.design_ratio)  //设计费率
            if(design_ratio < 99.00){
              //更新费用
              this.req_startup.order_startup.design_cost = (design_ratio / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.process_cost = ((100 - design_ratio) / 2 / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.stuff_cost = ((100 - design_ratio) /2 / 100 * up_not_tax).toFixed(2)

              //更新费率
              let design_cost = parseFloat(this.req_startup.order_startup.design_cost)  //设计费
              this.req_startup.order_startup.process_ratio = ((up_not_tax - design_cost) / 2 / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.stuff_ratio = ((up_not_tax - design_cost) / 2 / up_not_tax * 100).toFixed(2)
            }else{  //如果填写的费率超过百分之99,则当前费用变成百分之98. 其余两种各百分之一

              //下面三行更新费率
              this.req_startup.order_startup.design_ratio = 98.00
              this.req_startup.order_startup.process_ratio = 1.00
              this.req_startup.order_startup.stuff_ratio = 1.00

              //这下面的代码是更新其它的费用
              this.req_startup.order_startup.design_cost = (up_not_tax * 0.98).toFixed(2)
              this.req_startup.order_startup.process_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.stuff_cost = (up_not_tax * 0.01).toFixed(2)
            }

            break;
          case 'process':
            let process_ratio = parseFloat(this.req_startup.order_startup.process_ratio)  //加工费率
            if(process_ratio < 99.00){
              //更新费用
              this.req_startup.order_startup.process_cost = (process_ratio / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.design_cost = ((100 - process_ratio) / 2 / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.stuff_cost = ((100 - process_ratio) /2 / 100 * up_not_tax).toFixed(2)

              //更新费率
              let process_cost = parseFloat(this.req_startup.order_startup.process_cost)  //加工费
              this.req_startup.order_startup.design_ratio = ((up_not_tax - process_cost) / 2 / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.stuff_ratio = ((up_not_tax - process_cost) / 2 / up_not_tax * 100).toFixed(2)
            }else{

              //下面三行更新费率
              this.req_startup.order_startup.design_ratio = 1.00
              this.req_startup.order_startup.process_ratio = 98.00
              this.req_startup.order_startup.stuff_ratio = 1.00

              //这下面的代码是更新其它的费用
              this.req_startup.order_startup.design_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.process_cost = (up_not_tax * 0.98).toFixed(2)
              this.req_startup.order_startup.stuff_cost = (up_not_tax * 0.01).toFixed(2)
            }

            break;
          case 'stuff':
            let stuff_ratio = parseFloat(this.req_startup.order_startup.stuff_ratio)  //材料费率
            console.log(stuff_ratio)
            if(stuff_ratio < 99.00){
              console.log('小于')
              //更新费用
              this.req_startup.order_startup.stuff_cost = (stuff_ratio / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.process_cost = ((100 - stuff_ratio) / 2 / 100 * up_not_tax).toFixed(2)
              this.req_startup.order_startup.design_cost = ((100 - stuff_ratio) /2 / 100 * up_not_tax).toFixed(2)

              //更新费率
              let stuff_cost = parseFloat(this.req_startup.order_startup.stuff_cost)  //材料费
              this.req_startup.order_startup.process_ratio = ((up_not_tax - stuff_cost) / 2 / up_not_tax * 100).toFixed(2)
              this.req_startup.order_startup.design_ratio = ((up_not_tax - stuff_cost) / 2 / up_not_tax * 100).toFixed(2)

            }else{

              //下面三行更新费率
              this.req_startup.order_startup.design_ratio = 1.00
              this.req_startup.order_startup.process_ratio = 1.00
              this.req_startup.order_startup.stuff_ratio = 98.00

              //这下面的代码是更新其它的费用
              this.req_startup.order_startup.design_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.process_cost = (up_not_tax * 0.01).toFixed(2)
              this.req_startup.order_startup.stuff_cost = (up_not_tax * 0.98).toFixed(2)
            }

            break;
          default:
            break;
        }

      },
      orderStartup(){ //订单产品下达
        let up_not_tax = parseFloat(this.req_startup.order_startup.up_not_tax)  //未税单价
        let design_cost = parseFloat(this.req_startup.order_startup.design_cost)  //设计费
        let process_cost = parseFloat(this.req_startup.order_startup.process_cost)  //加工费
        let stuff_cost = parseFloat(this.req_startup.order_startup.stuff_cost)  //材料费
        if((design_cost + process_cost + stuff_cost) == up_not_tax){
          orderStartup(this.req_startup)
            .then(res => {
              this.$message({
                type:'success',
                message:'下达成功'
              })
              this.getList()
              this.isShowStart = false
            })
            .catch(err => {
              console.log(err)
              this.$message.error('下达失败!')
            })
        }else {
          this.$message.error('错误!所有费用总和必须等于未税单价!')
        }
      },
      orderNotEnd(lineId){  //反完结
        let req_ONE = {
          client_type:1,
          order_line_id:lineId
        }
        orderNotEnd(req_ONE)
          .then(res => {
            this.$message({
              type:'success',
              message:'反完结成功'
            })
            this.getList()
          })
          .catch(err => {
            console.log(err)
            this.$message.error('反完结失败!')
          })
      },
      orderRestartup(lineId){ //开始
        let req_OR = {
          client_type:1,
          order_line_id:lineId
        }
        orderRestartup(req_OR)
          .then(res => {
            this.$message({
              type:'success',
              message:'开始成功'
            })
            this.getList()
          })
          .catch(err => {
            console.log(err)
            this.$message.error('开始失败!')
          })
      },
      showSS(flag,lineId){
        this.req_OSS.flag = flag
        this.req_OSS.order_line_id = lineId
        this.req_OSS.reason = ''
        this.isShowSS = true
      },
      orderStartupStop(){  //暂停或完结
        orderStartupStop(this.req_OSS)
          .then(res => {
            if(this.req_OSS.flag == 1){
              this.$message({
                type:'success',
                message:'暂停成功'
              })
              this.isShowSS = false
            }else{
              this.$message({
                type:'success',
                message:'完结成功'
              })
              this.isShowSS = false
            }
            this.getList()
          })
          .catch(err => {
            console.log(err)
            if(this.req_OSS.flag == 1){
              this.$message.error('暂停失败!')
            }else{
              this.$message.error('完结失败!')
            }
          })
      }
    }
  }
</script>

<style lang="scss">
  .my-autocomplete {
    li {
      line-height: normal;
      padding: 7px;

      .name {
        text-overflow: ellipsis;
        overflow: hidden;
      }

      .highlighted .addr {
        color: #ddd;
      }
    }
  }
  .article-textarea textarea {
    padding-right: 40px;
    resize: none;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid #bfcbd9;
  }
</style>
